<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //再函数声明的过程中参数称之为 形参
      //再函数调用的过程中参数称之为 实参
      //带参数的函数调用
      //函数名(实参1,实参2,实参3)
      /* function aAa(a) {
        var b = 0;
        for (var i = 1; i <= a; i++) {
          b += i;
        }
        alert(b);
      }
      //调用
    //   aAa(100);
      aAa(1000); */

      /*      //  1. 求n - m之间的和;
      function aAa(n, m) {
        var b = 0;
        for (var i = n; i <= m; i++) {
          b += i;
        }
        alert(b);
        // console.log(b);
      }
      aAa(100, 200); */
      //2.完成函数冒泡排序
      function aAa(arr) {
        for (var i = 0; i <= arr.length - 1; i++) {
          for (var b = 0; b <= arr.length - 1 - i; b++)
            if (arr[b] > arr[b + 1]) {
              var c = arr[b];
              arr[b] = arr[b + 1];
              arr[b + 1] = c;
            }
        }
        // alert(arr);
        console.log(arr);
      }
      aAa([1000, 300, 500, 100]);
    </script>
  </body>
</html>
